<%@page import="model.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	User u = new User();
	String uid =null;
	National national = new National();
	//kiem tra có phải admin không nếu khong thi redirect home
	if (!u.isAdmin((String) session.getAttribute("lv"))) {
		response.sendRedirect("../index.jsp");
	}else{
		uid = (String) session.getAttribute("uid");
	}
	//get lay gia trị nid
	String enn = (String ) request.getAttribute("enn");
	String nid = (String) request.getParameter("nid");
	/* nid nếu không tồn tại hoặc người dùng nhập vào không đúng thì báo lỗi và redirect về adminhome */
		if (!national.isNID(nid)) {
			response.sendRedirect("message.jsp?m=err-nid&r=vn");
		}else {
			nid = nid.trim();
			national = national.getNational(Integer.parseInt(nid));
		}
%>
<title>MYFILM - Register</title>
		<form id="edit_nt" action="EditNational" method="post">
			<fieldset>
				<legend>Edit National</legend>
				<div>
					<label for="nn">National Name: <%=national.getN_name() %><span class="required">*</span>
					</label> <input type="text" name="nn" id="national"
						value="<%=national.getN_name() %>" size="20" maxlength="150"
						tabindex="1" />
				</div>
				<div>
					<label for="pt">Position: <span class="required">*</span>
						<p class='warning'>Please pick a position</p>
					</label> <select name="pt" tabindex='2'>
						<%for(int i = 1; i<=national.getSizeDB();i++){ %>
						<option value="<%= i%>" <%=(i==national.getPosition())? "selected='selected'":"" %> ><%= i%></option>
						<%} %> 
					</select>
				
				</div>
					<input type="hidden" name="uid" value="<%=uid %>"/>
					<input type="hidden" name="nid" value="<%=national.getNid() %>"/>
			</fieldset>
			<p>
				<input type="submit" name="submit" value="Set National" />
			</p>
		</form>